home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / bbsutil / bsrc_250.zip / B_SBINIT.C < prev    next >
C/C++ Source or Header  |  1991-09-15  |  15KB  |  381 lines

  1. /*--------------------------------------------------------------------------*/
  2. /*                                                                          */
  3. /*                                                                          */
  4. /*      ------------         Bit-Bucket Software, Co.                       */
  5. /*      \ 10001101 /         Writers and Distributors of                    */
  6. /*       \ 011110 /          Freely Available<tm> Software.                 */
  7. /*        \ 1011 /                                                          */
  8. /*         ------                                                           */
  9. /*                                                                          */
  10. /*  (C) Copyright 1987-91, Bit Bucket Software Co., a Delaware Corporation. */
  11. /*                                                                          */
  12. /*                                                                          */
  13. /*            This module was originally written by Bob Hartman             */
  14. /*                                                                          */
  15. /*                                                                          */
  16. /*                  BinkleyTerm Initial Fullscreen Setup                    */
  17. /*                                                                          */
  18. /*                                                                          */
  19. /*    For complete  details  of the licensing restrictions, please refer    */
  20. /*    to the License  agreement,  which  is published in its entirety in    */
  21. /*    the MAKEFILE and BT.C, and also contained in the file LICENSE.250.    */
  22. /*                                                                          */
  23. /*    USE  OF THIS FILE IS SUBJECT TO THE  RESTRICTIONS CONTAINED IN THE    */
  24. /*    BINKLEYTERM  LICENSING  AGREEMENT.  IF YOU DO NOT FIND THE TEXT OF    */
  25. /*    THIS  AGREEMENT IN ANY OF THE  AFOREMENTIONED FILES,  OR IF YOU DO    */
  26. /*    NOT HAVE THESE FILES,  YOU  SHOULD  IMMEDIATELY CONTACT BIT BUCKET    */
  27. /*    SOFTWARE CO.  AT ONE OF THE  ADDRESSES  LISTED BELOW.  IN NO EVENT    */
  28. /*    SHOULD YOU  PROCEED TO USE THIS FILE  WITHOUT HAVING  ACCEPTED THE    */
  29. /*    TERMS  OF  THE  BINKLEYTERM  LICENSING  AGREEMENT,  OR  SUCH OTHER    */
  30. /*    AGREEMENT AS YOU ARE ABLE TO REACH WITH BIT BUCKET SOFTWARE, CO.      */
  31. /*                                                                          */
  32. /*                                                                          */
  33. /* You can contact Bit Bucket Software Co. at any one of the following      */
  34. /* addresses:                                                               */
  35. /*                                                                          */
  36. /* Bit Bucket Software Co.        FidoNet  1:104/501, 1:343/491             */
  37. /* P.O. Box 460398                AlterNet 7:491/0                          */
  38. /* Aurora, CO 80046               BBS-Net  86:2030/1                        */
  39. /*                                Internet f491.n343.z1.fidonet.org         */
  40. /*                                                                          */
  41. /* Please feel free to contact us at any time to share your comments about  */
  42. /* our software and/or licensing policies.                                  */
  43. /*                                                                          */
  44. /*--------------------------------------------------------------------------*/
  45.  
  46. /* Include this file before any other includes or defines! */
  47.  
  48. #include "includes.h"
  49.  
  50. #ifndef MILQ
  51. #define WHOLEWIN
  52. #endif
  53.  
  54. #ifdef MILQ
  55. #define MENU_ENABLED
  56. #if defined (MENU_ENABLED) || defined (MILQ)
  57. #define RESOURCE_ENABLED
  58. #endif
  59. #endif
  60.  
  61. extern VIOMODEINFO vfos_mode;
  62. void MilqMassageWnd( REGIONP Win, int Color );
  63.  
  64. #ifdef MILQ
  65. int PASCAL color_enum( HWND hWnd,
  66.                        DWORD lParam ) {
  67.   WinSetAttr( hWnd, (int)lParam, FALSE );
  68.   return TRUE;
  69.   }
  70.  
  71. HWND MilqDlgCreate( REGIONP  Win,
  72.                     char    *Nm,
  73.                     DLGPROC *dlgfunc,
  74.                     int      Color ) {
  75.   Win->hWnd = CreateDialog( MilqueRsrc, Nm, MilqueMailerWnd, dlgfunc );
  76.   MilqMassageWnd( Win, Color );
  77.   return Win->hWnd;
  78.   }
  79.  
  80. void MilqMassageWnd( REGIONP Win,
  81.                      int     Color ) {
  82.   int                   Bgd = WHITE;
  83.   HWND                  hMenu;
  84.  
  85.   hMenu = GetSystemMenu( Win->hWnd, FALSE );
  86.   DeleteMenu( hMenu, SC_CLOSE, MF_BYCOMMAND );
  87.   AppendMenu( hMenu, MF_ENABLED, SC_SIZE, "~Size" );
  88.   GetWindowRect( Win->hWnd, &Win->MilqSave.OrgRect );
  89.   if ( !UseWinColors ) {
  90.     if ( Color ) {
  91.       WinSetAttr( Win->hWnd, Color, FALSE );
  92.       EnumChildWindows( Win->hWnd, color_enum, (long)Color );
  93.       }                                /* end of if ( Color )         */
  94.     }                                  /* end of if ( !UseWinColors ) */
  95.   SetFocus( Win->hWnd );
  96.   }
  97. #endif
  98.  
  99. void b_sbinit () {
  100. #ifdef MILQ
  101.    char                 Buf[81];
  102. #endif
  103.  
  104.    register int         r;
  105.    char                *savep;
  106.  
  107. #ifdef MILQ
  108.    KbMapSet( &UnattendedKeyFncHdr );
  109.    WinInit();
  110.    MDIInitialize();
  111.    MilqueClassRegister();
  112.    WinUseSysColors (MilqueRootWnd, TRUE);
  113.    OrgVidInfo.VidMode = VidGetMode();
  114.    WinUseMonoMap( TRUE );
  115.  
  116.    MilqueRsrc = OpenResourceFile((PSTR) PRDCT_PRFX);
  117.  
  118.    /* Fetch the ega status and toggle if needed */
  119.  
  120.    UseWinColors = GetPrivateProfileInt( "Milque", "UseWinColors", 0, "Milque.Ini" );
  121.    node_Pwd_Enable = GetPrivateProfileInt( "Milque", "PWD", 0, "Milque.Ini" );
  122. #ifdef NEW_BIG_SCREEN
  123.    switch ( VidQueryAdapterType() ) {
  124.      case CGA:
  125.      case MDA:
  126.        break;
  127.      default:
  128.        if ( GetPrivateProfileInt( "Milque", "EGA", 0, "Milque.Ini" ) ) {
  129.          ToggleEGA();
  130.          MilqueVidInfo.EGAState = TRUE;
  131.          }
  132.        break;
  133.      }
  134. #endif
  135.  
  136.    if ( !( MilqueMailerAccel = LoadAccelerators( MilqueRsrc,
  137.                                                  (LPSTR)"MailerAccel" ) ) ) {
  138.      MessageBox( MilqueRootWnd,
  139.                  (PSTR)"Cannot load Mailer Accelerators",
  140.                  (PSTR)"Fatal Error",
  141.                  MB_OK );
  142.      exit(1);
  143.      }
  144.    MilqueActvAccel = MilqueMailerAccel;
  145.    if ( !( MilqueTrmnlAccel = LoadAccelerators( MilqueRsrc,
  146.                                                 (LPSTR)"TrmnlAccel" ) ) ) {
  147.      MessageBox( MilqueRootWnd,
  148.                  (PSTR)"Cannot load Terminal Accelerators",
  149.                  (PSTR)"Fatal Error",
  150.                  MB_OK );
  151.      exit(1);
  152.      }
  153.    if ( !( MilqueMailerMnu = LoadMenu( MilqueRsrc, (LPSTR)"MailerMenu" ) ) ) {
  154.      MessageBox( MilqueRootWnd,
  155.                  (PSTR)"Cannot load the menu",
  156.                  (PSTR)"Fatal Error",
  157.                  MB_OK);
  158.      exit(1);
  159.      }
  160.  
  161.    randomize();
  162.    MilqueMailerWnd = CreateWindow( (PSTR)"Normal",       /* class */
  163.                                    (PSTR)"BTMewel",      /* title */
  164.                                    WIN_HAS_BORDER   |
  165.                                      WIN_MINMAXBOX  |
  166.                                      WIN_MOVEBOX    |
  167.                                      WIN_SIZEBOX    |
  168.                                      WIN_SYSMENU    |
  169.                                      WIN_TITLEBAR   |
  170.                                      WS_CLIP        |
  171.                                      WS_MAXIMIZEBOX |
  172.                                      WS_MINIMIZEBOX,
  173.                                    0,0,            /* x,y,width,height */
  174.                                    GetSystemMetrics(SM_CXSCREEN),
  175.                                    GetSystemMetrics(SM_CYSCREEN),
  176.                                    MilqueRootWnd,   /* hParent */
  177.                                    MilqueMailerMnu,  /* hMenu */
  178.                                    0,              /* hInst */
  179.                                    0L);           /* lpParam */
  180.    MilqueActvWnd = MilqueMailerWnd;
  181.    WinSetWinProc( MilqueMailerWnd, MailerWndPrc );
  182. #endif
  183.  
  184.    savep = calloc (1, 4096);
  185.    for (r = 0; r < 132; r++)
  186.       {
  187.       blanks[r * 2] = ' ';
  188.